use compute program REPRODUCIBLE by default
authorJoey Hess <joeyh@joeyh.name>
Tue, 25 Feb 2025 21:10:41 +0000 (17:10 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 25 Feb 2025 21:10:41 +0000 (17:10 -0400)
Command/AddComputed.hs
doc/git-annex-addcomputed.mdwn

index 4edce492e26aae78933eb5f4439337a8979f99ea..0d614a1fc0ff02d4b36b4324da0e7dfbb3ea26a6 100644 (file)
@@ -37,14 +37,14 @@ cmd = notBareRepo $
 data AddComputedOptions = AddComputedOptions
        { computeParams :: CmdParams
        , computeRemote :: DeferredParse Remote
-       , reproducible :: Reproducible
+       , reproducible :: Maybe Reproducible
        }
 
 optParser :: CmdParamsDesc -> Parser AddComputedOptions
 optParser desc = AddComputedOptions
        <$> cmdParams desc
        <*> (mkParseRemoteOption <$> parseToOption)
-       <*> (fromMaybe (Reproducible False) <$> parseReproducible)
+       <*> parseReproducible
 
 newtype Reproducible = Reproducible { isReproducible :: Bool }
 
@@ -92,7 +92,7 @@ perform o r program = do
                , Remote.Compute.computeInputs = mempty
                , Remote.Compute.computeOutputs = mempty
                , Remote.Compute.computeSubdir = subdir
-               , Remote.Compute.computeReproducible = isreproducible
+               , Remote.Compute.computeReproducible = False
                }
        fast <- Annex.getRead Annex.fast
        starttime <- liftIO currentMonotonicTimestamp
@@ -140,7 +140,7 @@ perform o r program = do
                | fast = do
                        addSymlink outputfile stateurlk Nothing
                        return stateurlk
-               | isreproducible = do
+               | isreproducible state = do
                        sz <- liftIO $ getFileSize outputfile'
                        metered Nothing sz Nothing $ \_ p ->
                                ingestwith $ ingestAdd p (Just ld)
@@ -170,4 +170,6 @@ perform o r program = do
        calcduration (MonotonicTimestamp starttime) (MonotonicTimestamp endtime) =
                fromIntegral (endtime - starttime) :: NominalDiffTime
        
-       isreproducible = isReproducible (reproducible o)
+       isreproducible state = case reproducible o of
+               Just v -> isReproducible v
+               Nothing -> Remote.Compute.computeReproducible state
index 9f096770b70c397b11fc6946686e4f6b591218e8..1da287f0cf18d7c9168fa091f61cf611e0b7403e 100644 (file)
@@ -53,8 +53,11 @@ Some examples of how this might look:
 
 * `--fast`
 
-  Adds computed files to the repository, without generating their content
-  yet.
+  Adds computed files to the repository, without doing any work yet to
+  compute their content.
+
+  This implies `--unreproducible`, because even if the compute remote
+  produces reproducible output, it's not available.
 
 * `--unreproducible`, `-u`
 
@@ -70,7 +73,7 @@ Some examples of how this might look:
   Indicate that the computation is expected to be fully reproducible.
 
   This is the default when the compute remote indicates that it produces
-  reproducible output.
+  reproducible output (except when using `--fast`).
 
   If a computation turns out not to be fully reproducible, then getting
   the file from the compute remote will later fail with a checksum